-
-
Notifications
You must be signed in to change notification settings - Fork 278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Arduino service #812
Arduino service #812
Conversation
Codecov Report
@@ Coverage Diff @@
## master #812 +/- ##
==========================================
- Coverage 94.52% 94.47% -0.05%
==========================================
Files 485 497 +12
Lines 6444 6642 +198
==========================================
+ Hits 6091 6275 +184
- Misses 353 367 +14
Continue to review full report at Codecov.
|
Hi @billonalex , how did you sync your fork from master ? |
Hi @VonOx , To merge from the original repo, I used :
and
each time a new commit appeared in GladysAssistant repo. |
Ok its fine ! Something weird with my github ( and me :-) ) Nice job btw |
Yeah, when I ran prettier, the "tests/services/philips-hue/lights.json" changed, which caused bugs during tests ! So I manually corrected the file by cancelling changes prettier made on this file and discarding when running prettier after. Technically the file is now the same as it used to be 🙂 |
Thanks for your PR ! I agree with @VonOx, @billonalex I'm not sure you're merging your fork with master the right way, I see some files from other PRs affected here, and sometimes it's conflicting with the master branch: |
Hi @Pierre-Gilles, I just merged your latest commits. There shouldn't be conflict anymore. However, I don't understand how could I merge my fork with master the right way ? I do the exact step as described upper each time I have to merge changes. |
This time it seems good! You maybe did a mistake previously :) About codecov not passing, the diff coverage is available here: |
Perfect :) However, I'm a little confused about codecov... If some changes have to be made could you please give me some directions ? Thank you |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this very great PR ! 👏
This is rare to have such quality in a first shot, so congrats, you did something really great :)
I just read the server code for now, and I have a few feedbacks, mostly on error handling.
While it's great the catch errors, something errors should be thrown and sent back to the frontend so the frontend knows that something is wrong.
In Gladys 4, the user will never see the logs of Gladys 4, so the errors should be visible in the UI !
* @apiGroup Arduino | ||
*/ | ||
async function setup(req, res) { | ||
arduinoManager.setup(req.body); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I saw, this function never rejects any errors
How is the user going to know when something went wrong?
Error handling is very important and you shouldn't res.json({ success: true});
all the time. If something is wrong, reject a nice error message and in the UI display an explicit error message
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I modified setup.js script to return a json { success: true}
or { success: false}
to the front.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not what I said! You should reject errors, not resolves with { success: false}. When something is wrong, the HTTP code should not be "200 ok" but should be relative to the error.
This is an example in the Philips Hue library : https://github.com/GladysAssistant/Gladys/blob/master/server/services/philips-hue/lib/light/light.setValue.js
When something is wrong, we throw a clear error which will results in a "404" error, clear for the client.
We provide lots of errors in utils/coreErrors
and utils/httpErrors
. Let me know if you need more help :)
@Pierre-Gilles Thanks for your review 🙂 Changes are made. I run a prettier, local coverage and I push my changes ! |
Hello @Pierre-Gilles Did you have the time to look at changes that I made ? 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your changes! I added a feedback on the error handling :)
Btw, I'm waiting for people to test it on the forum before merging this.
Hi! Just wanted to know what's the status of this PR? :) |
Pull Request check-list
To ensure your Pull Request can be accepted as fast as possible, make sure to review and check all of these items:
npm test
on both front/server)npm run eslint
on both front/server)npm run prettier
on both front/server)npm run compare-translations
on front)front/src/config/demo.json
) so that the demo website is working without a backend? (if needed) See https://demo.gladysassistant.com.NOTE: these things are not required to open a PR and can be done afterwards / while the PR is open.
Description of change
Please provide a description of the change here. It's always best with screenshots, so don't hesitate to add some!
This PR is about the Arduino service. Gladys will now be able to interact with Arduino card. The user uploads the generic code on the card, setups the service, creates the device, and interacts with hardware.